package com.hhd.flow.support.variable;

import com.hhd.flow.engine.support.FlowFormSupport;
import com.hhd.flow.engine.support.FlowFormSupportAnnotation;
import com.hhd.flow.engine.utils.CommonUtils;
import com.hhd.flow.engine.variable.FlowVariableDefinition;
import com.hhd.flow.engine.variable.FlowVariablesContainer;
import com.hhd.flow.entity.FlowProcessInstance;
import com.hhd.flow.support.VariableComponent;
import com.tang.script.variable.Variable;
import com.tang.script.variable.VariablesType;

import java.util.List;

@FlowFormSupportAnnotation(formType = ".*")
public class SystemVariableFlowFormSupport implements FlowFormSupport, FlowVariablesContainer {
    @Override
    public FlowVariablesContainer loadVariableContainerForDefinition(String formTypeId, String formId, FlowProcessInstance processInstance) {
        return this;
    }

    @Override
    public List<FlowVariableDefinition> getFlowVariableDefinitions() {
        FlowVariableDefinition flowVariableDefinition = new FlowVariableDefinition();
        flowVariableDefinition.setVariableName("测试系统变量");
        flowVariableDefinition.setVariableTitle("测试系统变量");
        flowVariableDefinition.setVariableType(VariablesType.string);
        flowVariableDefinition.setGroupName("系统变量");
        flowVariableDefinition.setComponent(VariableComponent.InputComponent);
        return CommonUtils.asList(flowVariableDefinition);
    }

    @Override
    public Object getValue(Variable variable) {
        return null;
    }
}
